package com.zodiac.alioth.web.security;


import com.zodiac.alioth.web.security.auth.AuthUser;

/**
 * @author insight
 */
public class LoginContextHelper {

    public static AuthUser getLoginUser() {
        return AuthUser.getCurrentUser();
    }

    public static String getLoginUserId() {
        AuthUser currentUser = AuthUser.getCurrentUser();
        if (currentUser == null) {
            return null;
        }
        return currentUser.getUserId();
    }

    public static Long getLoginUid() {
        AuthUser currentUser = AuthUser.getCurrentUser();
        if (currentUser == null) {
            return null;
        }
        return currentUser.getUid();
    }


    public static boolean isLogin() {
        AuthUser currentUser = AuthUser.getCurrentUser();
        if (currentUser == null) {
            return false;
        }
        return currentUser.getUserId() != null;
    }
}
